<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title></title>

    [#include "/admin/include/admin_static.htm"]
    [#import "/admin/include/admin_pagination.ftl" as p/]

</head>
<body>
<div class="main_admin_content">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>招标中</legend>
    </fieldset>
    <form id="searchForm" method="post" action="${path}/admin/borrow/borrowList.aspx?status=3">
        <table class="search_table_div">
            <tr>
                <td class="column">项目类型：</td>
                <td>
                [@u.select listKey="id"  headerKey="" headerValue="全部类型" listValue="category_name" headerButtom="false" list=LoanCategoryUtils.getLoanCategoryList()
                name="loanCategory" value="${(loanCategory)!''}" /]
                </td>
                <td class="column">用户ID：</td>
                <td><input type="text" onkeyup="value=value.replace(/[^\d]/g,'')" class="layui-input" name="memberId" value="${memberId }" /></td>
                <td class="column">用户名：</td>
                <td><input type="text" name="memberName" value="${memberName }" /></td>
            </tr>
            <tr>
                <td class="column">项目ID：</td>
                <td><input type="text" onkeyup="value=value.replace(/[^\d]/g,'')" class="layui-input" name="loanId" value="${loanId }" /></td>
                <td class="column">日期：</td>
                <td>
                    <input type="text" onclick="WdatePicker();" value="${begin_date }"
                           name="begin_date" readonly="readonly" class="layui-icon" >

                    </input>
                    <i>至</i>
                    <input type="text" onclick="WdatePicker();" value="${end_date }"
                           name="end_date" readonly="readonly" class="layui-icon" />
                </td>
            </tr>
            <tr>
                <th colspan="100" class="btn_td">
                    <input id="export" type="button" class="layui-btn" style="float:left;width: 100px; heigth: 30px; line-height: 30px" value="导出">
                    <input id="query" type="button" class="layui-btn" value="查询"/>
                    <input onclick="resent();" type="button" class="layui-btn" value="清空"/>
                </th>
            </tr>
        </table>
    </form>
    <table class="layui-table">
        <colgroup>
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
        </colgroup>
        <thead>
        <tr>
            <th>项目类型</th>
            <th>用户ID</th>
            <th>用户名称</th>
            <th>项目ID</th>
            <th>项目名</th>
            <th>借款金额</th>
            <th>借款期限</th>
            <th>年化收益率</th>
            <th>发布时间</th>
            <th>招标期限</th>
            <th>到期时间</th>
            <th>已筹金额</th>
            <th>投标次数</th>
            <th>查看</th>
            <th>撤销</th>
            <th>截标</th>
        </tr>
        </thead>
        <tbody>
    [#list loans as loan]
        <tr>
            <td>${loan.category_name }</td>
            <td>${loan.user_id}</td>
            <td>
            ${loan.u_user_name}

            </td>
            <td>${loan.id }</td>
            <td>${loan.name }</td>

            <td>￥${loan.account}</td>
            <td>${loan.time_limit }
                [#if loan.is_day==1]
                    天
                [#elseif loan.is_day==0]
                    个月
                [/#if]</td>
            <td>${loan.apr }%</td>
            <td>
            ${p2p_date_format(loan.first_verify_time ,"yyyy-MM-dd HH:mm:ss")}

            </td>
            <td>${loan.valid_time}天</td>
            <td>
            ${p2p_date_format(loan.end_time ,"yyyy-MM-dd HH:mm:ss")}

            </td>
            <td>￥${loan.amount_invested}</td>
            <td>${loan.tender_times }次</td>
            <td>
                <input type="button" value="投标记录" onclick="window.location.href='${path}/admin/tender/tenderLog${loan.id}.aspx'" class="layui-btn "/>
            </td>
            <td>
                <input type="button" value="撤销" onclick="loan_cancle(${loan.id})" class="layui-btn "/>
            </td>
            <td>
                <input type="button" value="截标" onclick="cut(${loan.id})"  class="layui-btn "/>
            </td>
        </tr>
    [/#list]
        </tbody>
    </table>
[@p.pager pager = page parameterMap={"loanCategory":"${loanCategory }","memberId":"${memberId }","memberName":"${memberName }","begin_date":"${begin_date }","end_date":"${end_date }"}   url = "${path}/admin/borrow/borrowList.aspx?status=3"/]
</div>
</body>
<script>
    function cut(borrowid){
        oDialog.confirm('确定要截标吗？', function() {
                    ajax( {
                        type : "post",
                        url : '${path}/admin/borrow/cut.aspx',
                        data : {
                            "borrowId" : borrowid
                        },
                        success : function(result) {
                            oDialog.prompt(result.content, 1500,1500,function() {
                                window.location.reload();

                            });
                        }
                    });

                }
        )};

    function loan_cancle(borrowid){
        oDialog.confirm('确定要撤销吗？', function() {
                    ajax( {
                        type : "post",
                        url : '${path}/admin/borrow/loan_cancle.aspx',
                        data : {
                            "borrowId" : borrowid
                        },
                        success : function(result) {
                            oDialog.prompt(result.content, 1500,1500,function() {
                                window.location.reload();

                            });
                        }
                    });

                }
        )};
</script>
<script>
    $(function() {
        $("#export") .click( function() {
            $("#searchForm").attr("action", "${path }/admin/borrow/exportBorrowList.aspx?status=3").submit();
        });
    });
</script>
</html>